package com.example.hotel.web;

import com.example.hotel.entity.Reservation;
import com.example.hotel.service.HotelService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/reservations")
public class ReservationController {
    private final HotelService service;
    public ReservationController(HotelService service){ this.service = service; }

    @PostMapping
    public ResponseEntity<Reservation> create(@RequestBody Reservation r){ return ResponseEntity.ok(service.createReservation(r)); }

    @GetMapping
    public List<Reservation> list(){ return service.listReservations(); }
}
